package cn.tedu.sp04.feign;

import cn.tdeu.sp01.pojo.Item;
import cn.tdeu.sp01.web.util.JsonResult;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;


import cn.tdeu.sp01.pojo.Item;
import cn.tdeu.sp01.web.util.JsonResult;

import java.util.List;
@Component
public class ItemClientFB implements ItemClient {
    @Override
    public JsonResult<List<Item>> getItems(String orderId) {
        if(Math.random()<0.5){
            List<Item> list=new ArrayList<>();
            list.add(new Item(1, "缓存商品1", 2));
            list.add(new Item(2, "缓存商品2", 1));
            list.add(new Item(3, "缓存商品3", 4));
            list.add(new Item(4, "缓存商品4", 3));
            list.add(new Item(5, "缓存商品5", 2));
        }

        return JsonResult.err().msg("调用商品失败");
    }

    @Override
    public JsonResult<?> decreaseNumber(List<Item> items) {
        return JsonResult.err().msg("调用商品失败");
    }
}
